package luccy.exception;

import static luccy.Constants.EMPTY_ARGS;
import luccy.message.MessageFormatter;

/*
 * The base runtime exception.
 * You can use it instead of the runtime exception which just wrap exception.
 */
public class LuccyRuntimeException extends RuntimeException {

	private static final long serialVersionUID = 1L;

    private String messageCode;

    private Object[] args;

    public LuccyRuntimeException() {
    	this("ELCY0001", EMPTY_ARGS);
    }
    
    public LuccyRuntimeException(String messageCode, Object... args) {
        this(null, messageCode, args);
    }

    public LuccyRuntimeException(Throwable cause, String messageCode,
            Object... args) {
        super(MessageFormatter.getMessage(messageCode, args), cause);
        this.messageCode = messageCode;
        this.args = args;
    }

    public String getMessageCode() {
        return messageCode;
    }

    public Object[] getArgs() {
        return args;
    }

}
